import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { FeatureVO, FeatureForm, FeatureQuery } from '@/api/biz/feature/types';

/**
 * 查询要素列表
 * @param query
 * @returns {*}
 */

export const listFeature = (query?: FeatureQuery): AxiosPromise<FeatureVO[]> => {
  return request({
    url: '/biz/feature/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询要素详细
 * @param id
 */
export const getFeature = (id: string | number): AxiosPromise<FeatureVO> => {
  return request({
    url: '/biz/feature/' + id,
    method: 'get'
  });
};

/**
 * 新增要素
 * @param data
 */
export const addFeature = (data: FeatureForm) => {
  return request({
    url: '/biz/feature',
    method: 'post',
    data: data
  });
};

/**
 * 修改要素
 * @param data
 */
export const updateFeature = (data: FeatureForm) => {
  return request({
    url: '/biz/feature',
    method: 'put',
    data: data
  });
};

/**
 * 删除要素
 * @param id
 */
export const delFeature = (id: string | number | Array<string | number>) => {
  return request({
    url: '/biz/feature/' + id,
    method: 'delete'
  });
};
